POV-Ray : Newsgroups : povray.text.scene-files : Rainbow lightbeam? : Re: Rainbow lightbeam? Yes Server Time
3 Jul 2024 02:18:12 EDT (-0400)
  Re: Rainbow lightbeam? Yes  
From: Bob H 
Date: 19 Sep 2001 03:44:45
Message: <3ba84ced@news.povray.org>
/*
 Here's a quick try at it.  If you use a cone instead of the box the thin
edges won't look right, I can tell you that without even having tried it in
this.  At least not without first narrowing its thickness.  In fact this one
doesn't look very spectrum like when oriented away from the camera.
 This should be okay for POV-Ray 3.1
 You'll need to work out the layout from what's in the comments and object
transformations in order to use it in other ways of your own.
*/

// example of faked light spectrum from a prism

#declare Scale=5; // overall size
#declare Illum=2; // brightness

// prism paired with spectrum
union {

// prism
intersection {
        plane {x,.1}
        plane {x,.1 rotate 120*y}
        plane {x,.1 rotate 240*y}
        plane {-y,0}
        plane {+y,1}
 pigment {rgbf <0.8,1,0.9,1>}
 interior {ior 1.5}
   rotate -45*y scale <0.75,1,0.5> translate <-0.025,0,-0.025>
}

// media spectrum
box {0,1 hollow
        pigment {rgbt 1}
        interior {
                media {
                        emission 1
                       density { radial frequency 4
                         density_map {
                                [0 rgb <0,0,0>]
                                [0.1 rgb <1,0,0>*Illum/Scale]
                                [0.3 rgb <1,0.5,0>*Illum/Scale]
                                [0.4 rgb <1,1,0>*Illum/Scale]
                                [0.7 rgb <0,1,0>*Illum/Scale]
                                [0.85 rgb <0,1,1>*Illum/Scale]
                                [0.9 rgb <0,0,1>*Illum/Scale]
                                [1 rgb <0,0,0>]
                         }
                        }
                }
                media {
                        absorption 1
                       density { radial frequency 4
                         density_map {
                                [0 rgb <0,0,0>] // adjust colors to liking
                                [0.1 rgb <1,0,0>*Illum/Scale]
                                [0.3 rgb <1,0.5,0>*Illum/Scale]
                                [0.4 rgb <1,1,0>*Illum/Scale]
                                [0.7 rgb <0,1,0>*Illum/Scale]
                                [0.85 rgb <0,1,1>*Illum/Scale]
                                [0.9 rgb <0,0,1>*Illum/Scale]
                                [1 rgb <0,0,0>]
                         }
                        }
                }
        }
}
 rotate 45*y scale <2,1,1>*Scale

  rotate -42*x // -45 to align with camera as is (perpendicular)
}
// end spectrum

light_source {
        0,0.5
}

camera {
        location <0,0,-10>
        look_at <2,0.5,0.5>
        angle 30
        rotate 42*x // +45 to be opposite the wedges upper face when as
above
}

// room
box {-15,15
        pigment {rgb 0.9}
        finish {ambient 0.1}
 inverse
}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.